home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekkan Dennou Club 145
/
Gekkan Dennou Club - 2000.6 Vol. 145 (Japan).7z
/
Gekkan Dennou Club - 2000.6 Vol. 145 (Japan) (Track 1).bin
/
games
/
spassion
/
knowhow.lzh
/
ノウハウ
/
キョリケイサン.bas
< prev
next >
Wrap
BASIC Source File
|
1993-11-08
|
2KB
|
89 lines
int i
int x,y
int tx=128:ty=128
int cir(63)
float fx,fy
float f,dat
/*---------------
screen 0,2,1,1
/*#############[ アークタンジェント テ-ブル make ]#################
for i=0 to 63
fx=abs(i-32):fy=-32
if fx<>0 then {
dat=atan(fx/fy)
f=65536/cos(dat)
cir(i)=f
} else {
cir(i)=65536
}
next
/*
/*
/*#############[ ジッコウサンプル ]###########################
print "インチキ キョリケイサン"
for x=0 to 255
for y=0 to 255
pset(x,y,kyori(x-tx,y-ty)and 255)
next
if inkey$(0)<>"" then end
next
/*-------------
print "sqrカンスウ キョリケイサン"
for x=0 to 255
for y=0 to 255
pset(x,y,int(sqr((x-tx)*(x-tx)+(y-ty)*(y-ty)))+16)
next
if inkey$(0)<>"" then end
next
/*-------------
print "hit any key"
while inkey$(0)="":endwhile
/*#######################################################
/*
/* きょり きんじけいさん
/*
/* (x1,x2)ト(x2,y2)トノキョリハ、kyori(x1-x2,y1-y2)デモトマル。
/* モドリチ = キョリ
/*-------------------------------------------------------
func kyori(x,y)
int a,l,abs_x,abs_y
/*
if x=0 then x=1
if y=0 then y=1
if x>0 then abs_x=x else abs_x=-x
if y>0 then abs_y=y else abs_y=-y
if abs_x>abs_y then {
if x>0 then {
if y>0 then {
a=&h40 + ((y shl 5)+(abs_x shr 1))/abs_x
} else {
a=&h40 + ((y shl 5)-(abs_x shr 1))/abs_x
}
} else {
if y>0 then {
a=&hC0 - ((y shl 5)+(abs_x shr 1))/abs_x
} else {
a=&hC0 - ((y shl 5)-(abs_x shr 1))/abs_x
}
}
l=abs_x*cir(a+32 and 63) shr 16
} else {
if y>0 then {
if x>0 then {
a=&h80 - ((x shl 5)+(abs_y shr 1))/abs_y
} else {
a=&h80 - ((x shl 5)-(abs_y shr 1))/abs_y
}
} else {
if x>0 then {
a= ((x shl 5)+(abs_y shr 1))/abs_y
} else {
a= ((x shl 5)-(abs_y shr 1))/abs_y
}
}
l=abs_y*cir(a+32 and 63) shr 16
}
/*ーーーーーーーーーーーーーーーーー
return(l)
endfunc